//
//  CustomButton.m
//  CarLifes
//
//  Created by yu on 2017/7/26.
//  Copyright © 2017年 jpas. All rights reserved.
//

#import "CustomButton.h"

@implementation CustomButton

+ (UIButton *)buttonWithTitle:(NSString *)title bgColor:(UIColor *)bgColor image:(NSString *)image font:(CGFloat)font {
    UIButton *button = [[UIButton alloc] init];
    [button setTitle:title forState:UIControlStateNormal];
    if (@available(iOS 13.0, *)) {
        [button setTitleColor:[UIColor.labelColor colorWithAlphaComponent:0.85] forState:UIControlStateNormal];
    } else {
        [button setTitleColor:kTextBlackColor forState:UIControlStateNormal];
    }
    button.backgroundColor = bgColor;
    button.titleLabel.font = SYSTEM_FONT(font);
    [button setImage:IMAGE_NAMED(image) forState:UIControlStateNormal];
    
    return button;
}

// 不走该方法
//- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
//{
//    
//    if (CGRectContainsPoint(self.imageView.frame, point)) {
//        return self;
//    }
//    return nil;
//}

@end
